﻿using System.Collections.Generic;

namespace Coffee.ServiceLocators
{
    public abstract class ServiceLocator<T, U>
    {
        protected static Dictionary<T, U> providerdictionary = new Dictionary<T, U>();

        public static void AddProvider(T key, U value)
        {
            providerdictionary.Add(key, value);
        }

        public static U ResolveProvider(T key)
        {
            if (providerdictionary.ContainsKey(key))
                return providerdictionary[key];
            return default(U);
        }

    }
}
